# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: T.J. Townsend <blakkheim@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>

pkgname=exploitdb
_pkgver=2022-11-22
pkgver=${_pkgver//-/}
pkgrel=1
pkgdesc="Offensive Security’s Exploit Database Archive"
arch=('any')
url="https://www.exploit-db.com/"
license=('GPL')
optdepends=('libxml2: to check nmap XML results'
            'xclip: copy paths to the clipboard')
backup=('etc/searchsploit_rc')
options=('!strip')
source=("https://gitlab.com/exploit-database/exploitdb/-/archive/$_pkgver/exploitdb-$_pkgver.tar.gz"
        "rcfile.diff")
sha512sums=('c271fdf88d8b792557c7815643ded137115a6e05c417e920279d56df18b9655648f75f6bc5a70af5b0fc4ef18a6bff027d70620cd6c674a78b1a46581ae41e00'
            'e170da5b974975c6c23c5b09e8c1825bbb17446fb506f2d00f92f86f94394acf18a53458bd90969de38da642fc1f7abb08ba940969108002dab17415b88211d6')
b2sums=('f1df0c2ca6f00dd33174ef93c055ab4830909a67ce1c7b8adf1e5cca14a59f8f840e362a36ac955e238ca2dba0e9490ced0707bd44723724f59f877e225490ed'
        'f033a50db6358297580363d62bbd9d4a6003b5476ba361650133841138af76b990ed49e2e34d487cf4167ebeb3cd6b8f9230e5e700a5d96f7f06cbc5b42c4076')

prepare() {
    cd ${pkgname}-${_pkgver}

    patch -p1 -i ../rcfile.diff
}

package() {
    cd ${pkgname}-${_pkgver}

    install -Dm755 searchsploit "${pkgdir}"/usr/bin/searchsploit
    install -Dm644 .searchsploit_rc "${pkgdir}"/etc/searchsploit_rc
    mkdir -p "${pkgdir}"/usr/share/${pkgname}
    cp -a exploits/ shellcodes/ files_*.csv "${pkgdir}"/usr/share/${pkgname}
}

# vim: ts=4 sw=4 et:
